<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>资产查询</title>
    </h:head>
    <h:body>
        <h:form id="emp">
            <rich:panel header="资产查询" styleClass="content-hight">
                <h:panelGrid columns="2">
                    <h:outputLabel value="部 门: " />
                    <h:selectOneMenu  value="#{assetQueryBean.asset.dept.code}"
                                      valueChangeListener="#{deptAndEmp.deptChange1}">
                        <f:selectItem itemValue="" itemLabel="-请选择-"/>
                        <f:selectItems value="#{deptAndEmp.selectItemList}"/>
                        <a4j:ajax event="change" render="usern"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="使用人: " />
                    <h:panelGroup id="usern">
                        <h:selectOneMenu  id="ausername"   value="#{assetQueryBean.asset.person.cpsn_name}">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItems value="#{deptAndEmp.person}" />
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <h:outputLabel value="资产名称:" />
                    <h:selectOneMenu  id="first" value="#{assetQueryBean.asset.assetName}" >
                        <f:selectItem itemValue="" itemLabel="-请选择-"/>
                        <f:selectItems value="#{assetQueryBean.seleli}"/>
                    </h:selectOneMenu>

                    <h:outputText value="购置日期："/>
                    <h:panelGroup id="purchDate">
                        <rich:calendar value="#{assetQueryBean.asset.purchDateB}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false"  style="width:180px"/>
                        至
                        <rich:calendar value="#{assetQueryBean.asset.purchDateE}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false"  style="width:180px"/>
                    </h:panelGroup>
                    <h:outputText value="质保日期："/>
                    <h:panelGroup id="shelfLife">
                        <rich:calendar value="#{assetQueryBean.asset.shelfLifeB}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false"  style="width:180px"/>
                        至
                        <rich:calendar value="#{assetQueryBean.asset.shelfLifeE}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false"  style="width:180px"/>
                    </h:panelGroup>
                    <h:outputLabel value="单价：" />
                    <h:panelGroup>
                        <h:inputText size="20" id="payaccountStart" value="#{assetQueryBean.asset.priceB}"/>
                        -<h:inputText size="20" id="payaccountEnd" value="#{assetQueryBean.asset.priceE}"/>
                    </h:panelGroup>
                </h:panelGrid>
                <a4j:commandButton value="查询" action="#{assetQueryBean.queryList}" render="dataGroup"/>
                <h:commandButton value="导出Excel" action="#{assetQueryBean.exportExcel}"/>
                <hr/>
                <h:panelGroup id="dataGroup">
                    <rich:dataScroller for="assetListTable"/>
                    <div style="width:750px;overflow: auto;">
                        <rich:dataTable id="assetListTable"
                                        value="#{assetQueryBean.assetlist}" var="asset"
                                        rowClasses="list-row-odd,list-row-even"
                                        headerClass="table-header"
                                        style="max-height:260px; width:1235px;"
                                        rows="10">
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="资产编号"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText  value="#{asset.assetCode}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="资产名称"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{asset.assetName}" />
                            </rich:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="规格型号"/>
                                </f:facet>
                                <h:outputText value="#{asset.model}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="部门名称"/>
                                </f:facet>
                                <h:outputText value="#{asset.dept.name}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="使用人"/>
                                </f:facet>
                                <h:outputText value="#{asset.person.cpsn_name}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="单价"/>
                                </f:facet>
                                <h:outputText value="#{asset.price}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="品牌"/>
                                </f:facet>
                                <h:outputText value="#{asset.brand}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="厂商"/>
                                </f:facet>
                                <h:outputText value="#{asset.manufacture}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="购置日期"/>
                                </f:facet>
                                <h:outputText value="#{asset.purchDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="质保日期"/>
                                </f:facet>
                                <h:outputText value="#{asset.shelfLife}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="使用状况"/>
                                </f:facet>
                                <h:outputText value="在用"  rendered="#{asset.useStatus == '0'}"/>
                                <h:outputText value="报废"  rendered="#{asset.useStatus == '1'}" style="color:blue;"/>
                                <h:outputText value="报损"  rendered="#{asset.useStatus == '2'}" style="color:red;"/>
                                <h:outputText value="其他"  rendered="#{asset.useStatus == '3'}" style="color:ccddff;"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="备注"/>
                                </f:facet>
                                <h:outputText value="#{asset.memo}"/>
                            </h:column>
                        </rich:dataTable>
                    </div>
                </h:panelGroup>
            </rich:panel>
        </h:form>
    </h:body>
</ui:composition>

